/**
 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.vijayan.profile.model;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.model.impl.BaseModelImpl;

import java.io.Serializable;

import java.lang.reflect.Proxy;

/**
 * @author vijayan
 */
public class FamilyMemberClp extends BaseModelImpl<FamilyMember>
	implements FamilyMember {
	public FamilyMemberClp() {
	}

	public long getPrimaryKey() {
		return _memberId;
	}

	public void setPrimaryKey(long pk) {
		setMemberId(pk);
	}

	public Serializable getPrimaryKeyObj() {
		return new Long(_memberId);
	}

	public long getMemberId() {
		return _memberId;
	}

	public void setMemberId(long memberId) {
		_memberId = memberId;
	}

	public long getProfileId() {
		return _profileId;
	}

	public void setProfileId(long profileId) {
		_profileId = profileId;
	}

	public String getMemberName() {
		return _memberName;
	}

	public void setMemberName(String memberName) {
		_memberName = memberName;
	}

	public String getRelationship() {
		return _relationship;
	}

	public void setRelationship(String relationship) {
		_relationship = relationship;
	}

	public boolean getMarried() {
		return _married;
	}

	public boolean isMarried() {
		return _married;
	}

	public void setMarried(boolean married) {
		_married = married;
	}

	public boolean getAvailable() {
		return _available;
	}

	public boolean isAvailable() {
		return _available;
	}

	public void setAvailable(boolean available) {
		_available = available;
	}

	public FamilyMember toEscapedModel() {
		if (isEscapedModel()) {
			return this;
		}
		else {
			return (FamilyMember)Proxy.newProxyInstance(FamilyMember.class.getClassLoader(),
				new Class[] { FamilyMember.class },
				new AutoEscapeBeanHandler(this));
		}
	}

	public Object clone() {
		FamilyMemberClp clone = new FamilyMemberClp();

		clone.setMemberId(getMemberId());
		clone.setProfileId(getProfileId());
		clone.setMemberName(getMemberName());
		clone.setRelationship(getRelationship());
		clone.setMarried(getMarried());
		clone.setAvailable(getAvailable());

		return clone;
	}

	public int compareTo(FamilyMember familyMember) {
		long pk = familyMember.getPrimaryKey();

		if (getPrimaryKey() < pk) {
			return -1;
		}
		else if (getPrimaryKey() > pk) {
			return 1;
		}
		else {
			return 0;
		}
	}

	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}

		FamilyMemberClp familyMember = null;

		try {
			familyMember = (FamilyMemberClp)obj;
		}
		catch (ClassCastException cce) {
			return false;
		}

		long pk = familyMember.getPrimaryKey();

		if (getPrimaryKey() == pk) {
			return true;
		}
		else {
			return false;
		}
	}

	public int hashCode() {
		return (int)getPrimaryKey();
	}

	public String toString() {
		StringBundler sb = new StringBundler(13);

		sb.append("{memberId=");
		sb.append(getMemberId());
		sb.append(", profileId=");
		sb.append(getProfileId());
		sb.append(", memberName=");
		sb.append(getMemberName());
		sb.append(", relationship=");
		sb.append(getRelationship());
		sb.append(", married=");
		sb.append(getMarried());
		sb.append(", available=");
		sb.append(getAvailable());
		sb.append("}");

		return sb.toString();
	}

	public String toXmlString() {
		StringBundler sb = new StringBundler(22);

		sb.append("<model><model-name>");
		sb.append("com.vijayan.profile.model.FamilyMember");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>memberId</column-name><column-value><![CDATA[");
		sb.append(getMemberId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>profileId</column-name><column-value><![CDATA[");
		sb.append(getProfileId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>memberName</column-name><column-value><![CDATA[");
		sb.append(getMemberName());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>relationship</column-name><column-value><![CDATA[");
		sb.append(getRelationship());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>married</column-name><column-value><![CDATA[");
		sb.append(getMarried());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>available</column-name><column-value><![CDATA[");
		sb.append(getAvailable());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private long _memberId;
	private long _profileId;
	private String _memberName;
	private String _relationship;
	private boolean _married;
	private boolean _available;
}